package com.wxq.demo.service;

import com.wxq.demo.model.User;
import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class HelloSender {
    @Autowired
    private AmqpTemplate amqpTemplate;

    public void send(String text) {
        amqpTemplate.convertAndSend("queue", text);
    }

    public void sendUser() {
        User user = new User();
        user.setUsername("wei");
        user.setPassword("123");
        amqpTemplate.convertAndSend("userQueue", user);
    }
}
